@extends("layout.admin")

@section("title")
    站点列表
@endsection

@section("content")
    {{--列表--}}
    <div class="layui-card-body ">
        <script type="text/html" id="toolbar">
            <div class="layui-btn-container">
                    <a class="layui-btn layui-btn-sm" onclick="admin.openLayerForm('{{ route("system.site.create") }}', '添加', 'POST', '500px', '350px')"><i class="layui-icon"></i>添加</a>
            </div>
        </script>
        <table lay-filter="table-hide" style="display: none"  lay-data="{toolbar: '#toolbar',defaultToolbar:['filter'],limit:{{count($siteList)}}}">
            <thead>
            <tr>
                <th lay-data="{field:'id',width:80, fixed: 'left', unresize: true, sort: true}">编号</th>
                <th lay-data="{field:'name'}">名称</th>
                <th lay-data="{field:'status'}">状态</th>
                <th lay-data="{field:'expire_at'}">截止日期</th>
                <th lay-data="{field:'created_at'}">创建时间</th>
                <th lay-data="{field:'updated_at'}">更新时间</th>
                <th lay-data="{field:'op',fixed: 'right', width:120, align:'center'}">操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach ($siteList as $site)
                <tr>
                    <td>{{ $site['id'] }}</td>
                    <td>{{ $site['name'] }}</td>
                    <td>{{ Code::name('SITE_STATUS',$site['status']) }}</td>
                    <td>{{ date('Y-m-d',$site['expire_at']) }}</td>
                    <td>{{ $site['created_at'] }}</td>
                    <td>{{ $site['updated_at'] }}</td>
                    <td data-field="controller">
                        @if ($site['id'])
                        <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail" href="{{ route("system.site.show", ['id' => $site['id']]) }}">查看</a>
                        <a class="layui-btn layui-btn-xs" onclick="admin.openLayerForm('{{ route("system.site.edit",['id' => $site['id']]) }}', '编辑', 'POST', '500px', '350px')">编辑</a>
                        @endif
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
@endsection

@section('script')
    <script>
        var idx=-1;
        layui.use(['form', 'table', 'layer'], function () {
            var table = layui.table;
            var form = layui.form;
            table.init("table-hide");

            // admin.paginate("12", "1", "10");
        });

    </script>
    <script src="{{asset('js/layCommon.js')}}"></script>
@endsection

